package com.qidian.qc.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.qidian.mes.pojo.qc.QcTemplateIndex;
import com.qidian.mes.pojo.qc.QcTemplateProduct;
import com.qidian.mes.util.pojo.MESResult;
import com.qidian.qc.mapper.QcTemplateMapper;
import com.qidian.qc.mapper.QcTemplateProductMapper;
import com.qidian.qc.service.QcTemplateProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author 53邹李萍
 * @Company 起点编程
 * @Time 2023/11/2 9:37
 * @Description
 */
@Service
@Transactional
public class QcTemplateProductServiceImpl implements QcTemplateProductService {
    @Autowired
    QcTemplateProductMapper qcTemplateProductMapper;
    @Autowired
    QcTemplateMapper qcTemplateMapper;
    //分页
    @Override
    public MESResult list(int page, int limit, String t) {
        Long id=qcTemplateMapper.getByTemplateCode(t).getTemplateId();
        PageHelper.startPage(page,limit);
        List<QcTemplateProduct> list1=qcTemplateProductMapper.list(id);
        PageInfo<QcTemplateProduct> pageInfo=new PageInfo<>(list1);
        return MESResult.ok(pageInfo);

    }
}
